<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户信息列表</title>
</head>
<body>
	<form action="" method="get">
		<input type="hidden" name="_method" value="get" /> 关键字<input
			type="text" name="keyword"> <input type="submit" value="查询">
	</form>
	<a href="/user/edit/new"> 新增用户</a>
	<c:if test="${empty requestScope.page || page.numberOfElements == 0 }">
没有任何信息
</c:if>
	<c:if test="${!empty requestScope.page && page.numberOfElements > 0 }">
		<table>
			<caption>用户列表</caption>
			<tbody>
				<tr>
					<th>序号</th>
					<th>用户名称</th>
					<th>用户昵称</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
				<c:forEach items="${page.content}" var="user" varStatus="status">
					<tr>
						<td>${status.index + page.number * page.size + 1}</td>
						<td>${user.username}</td>
						<td>${user.nickname}</td>
						<td><c:if test="${user.available}">可用</c:if> <c:if
								test="${!user.available}">停用</c:if></td>
						<td><a href="/user/edit/${user.id}">修改</a></td>
					</tr>
				</c:forEach>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="5">
						<form id="flipForm" action="" method="get">
							<input type="hidden" name="_method" value="get" /> <input
								type="hidden" name="keyword" value="${keyword}" /> 共
							${page.totalElements } 条记录 第 ${page.number +1} 页 共
							${page.totalPages } 页
							<c:if test="${page.number>0}">
								<input type="button"
									onclick="pageNo.value=${page.number-1};submit();" value="上一页" />
							</c:if>
							<c:if test="${page.number<page.totalPages-1}">
								<input type="button"
									onclick="pageNo.value=${page.number+1};submit();" value="下一页" />
							</c:if>
							<input name="pageNo" type="text" id="pageNo" size="2"
								onchange="submit();" /> <select id="pageSize" name="pageSize"
								onchange="submit();">
								<option value="5"
									<c:if test="${page.size == '5'}">selected</c:if>>5</option>
								<option value="10"
									<c:if test="${page.size == '10' || empty page.size}">selected</c:if>>10</option>
								<option value="15"
									<c:if test="${page.size == '15'}">selected</c:if>>15</option>
								<option value="20"
									<c:if test="${page.size == '20'}">selected</c:if>>20</option>
								<option value="30"
									<c:if test="${page.size == '30'}">selected</c:if>>30</option>
							</select>
						</form>
					</td>
				</tr>
			</tfoot>
		</table>
	</c:if>
</body>
</html>